package ms.common.page;

import java.io.Serializable;
import java.util.List;

/**
 * Project Name: ms
 * File Name: Page
 * Package Name: ms.common.page
 * Date: 2018/5/30  16:34
 * Copyright (c) 2018, tianyul All Rights Reserved.
 */
public class Page<T> implements Serializable {
    private int pageNo;
    private int pageSize;
    private long total;
    private List<T> data;

    private Page() {
    }

    public Page(int pageNo, int pageSize, long total, List<T> data) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.total = total;
        this.data = data;
    }

    public int getPageNo() {
        return this.pageNo;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public long getTotal() {
        return this.total;
    }

    public List<T> getdata() {
        return this.data;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public void setdata(List<T> data) {
        this.data = data;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof Page)) {
            return false;
        } else {
            Page<?> other = (Page)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.getPageNo() != other.getPageNo()) {
                return false;
            } else if (this.getPageSize() != other.getPageSize()) {
                return false;
            } else if (this.getTotal() != other.getTotal()) {
                return false;
            } else {
                Object this$data = this.getdata();
                Object other$data = other.getdata();
                if (this$data == null) {
                    if (other$data != null) {
                        return false;
                    }
                } else if (!this$data.equals(other$data)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof Page;
    }

    public int hashCode() {
        int result = 1;
        result = result * 59 + this.getPageNo();
        result = result * 59 + this.getPageSize();
        long $total = this.getTotal();
        result = result * 59 + (int)($total >>> 32 ^ $total);
        Object $data = this.getdata();
        result = result * 59 + ($data == null ? 43 : $data.hashCode());
        return result;
    }

    public String toString() {
        return "Page(pageNo=" + this.getPageNo() + ", pageSize=" + this.getPageSize() + ", total=" + this.getTotal() + ", data=" + this.getdata() + ")";
    }
}
